<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员控制台 - 在线判题系统</title>
    <link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background: #f5f7fa;
            min-height: 100vh;
        }

        /* 顶部导航栏 */
        .top-nav {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 0 30px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .nav-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .logo {
            font-size: 24px;
            font-weight: bold;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .nav-right {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 16px;
            background: rgba(255,255,255,0.2);
            border-radius: 20px;
        }

        .logout-btn {
            padding: 8px 20px;
            background: rgba(255,255,255,0.2);
            border: 1px solid rgba(255,255,255,0.3);
            color: white;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.3s;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

        .logout-btn:hover {
            background: rgba(255,255,255,0.3);
        }

        /* 主容器 */
        .container {
            margin-top: 60px;
            display: flex;
            min-height: calc(100vh - 60px);
        }

        /* 侧边栏 */
        .sidebar {
            width: 250px;
            background: white;
            box-shadow: 2px 0 10px rgba(0,0,0,0.05);
            padding: 20px 0;
            position: fixed;
            height: calc(100vh - 60px);
            overflow-y: auto;
        }

        .menu-title {
            padding: 10px 20px;
            color: #999;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-top: 20px;
        }

        .menu-title:first-child {
            margin-top: 0;
        }

        .menu-item {
            padding: 12px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            color: #333;
            text-decoration: none;
            transition: all 0.3s;
            cursor: pointer;
        }

        .menu-item:hover {
            background: #f0f2f5;
            padding-left: 25px;
        }

        .menu-item.active {
            background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
            border-left: 3px solid #667eea;
            color: #667eea;
        }

        .menu-item i {
            font-size: 18px;
        }

        /* 主内容区 */
        .main-content {
            margin-left: 250px;
            flex: 1;
            padding: 30px;
        }

        .page-header {
            margin-bottom: 30px;
        }

        .page-title {
            font-size: 28px;
            color: #333;
            margin-bottom: 10px;
        }

        .page-subtitle {
            color: #666;
            font-size: 14px;
        }

        /* 统计卡片 */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            background: white;
            border-radius: 12px;
            padding: 25px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            transition: all 0.3s;
        }

        .stat-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 20px rgba(0,0,0,0.1);
        }

        .stat-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 15px;
        }

        .stat-icon {
            width: 50px;
            height: 50px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
        }

        .stat-icon.purple {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .stat-icon.blue {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white;
        }

        .stat-icon.green {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white;
        }

        .stat-icon.orange {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            color: white;
        }

        .stat-value {
            font-size: 32px;
            font-weight: bold;
            color: #333;
            margin-bottom: 5px;
        }

        .stat-label {
            color: #666;
            font-size: 14px;
        }

        /* 功能卡片网格 */
        .feature-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }

        .feature-card {
            background: white;
            border-radius: 12px;
            padding: 25px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            transition: all 0.3s;
            cursor: pointer;
            text-decoration: none;
            color: inherit;
            display: block;
        }

        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 20px rgba(0,0,0,0.1);
        }

        .feature-header {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
        }

        .feature-icon {
            width: 50px;
            height: 50px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .feature-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
        }

        .feature-description {
            color: #666;
            font-size: 14px;
            line-height: 1.6;
            margin-bottom: 15px;
        }

        .feature-permissions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        .permission-badge {
            padding: 4px 10px;
            background: #f0f2f5;
            border-radius: 12px;
            font-size: 12px;
            color: #666;
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
            color: #333;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .section-title i {
            color: #667eea;
        }
    </style>
</head>
<body>
    <!-- 顶部导航栏 -->
    <div class="top-nav">
        <div class="nav-left">
            <div class="logo">
                <i class="ri-admin-line"></i>
                <span>管理员控制台</span>
            </div>
        </div>
        <div class="nav-right">
            <div class="user-info">
                <i class="ri-shield-star-fill"></i>
                <span th:text="${username}">管理员</span>
            </div>
            <a href="/perform_logout" class="logout-btn">
                <i class="ri-logout-box-line"></i> 退出登录
            </a>
        </div>
    </div>

    <!-- 主容器 -->
    <div class="container">
        <!-- 侧边栏 -->
        <div class="sidebar">
            <div class="menu-title">主菜单</div>
            <a href="/admin/index" class="menu-item active">
                <i class="ri-dashboard-line"></i>
                <span>控制台</span>
            </a>
            <a href="/index" class="menu-item">
                <i class="ri-home-line"></i>
                <span>返回首页</span>
            </a>

            <div class="menu-title">用户管理</div>
            <a href="/admin/users" class="menu-item">
                <i class="ri-user-line"></i>
                <span>用户管理</span>
            </a>

            <div class="menu-title">角色权限</div>
            <a href="/admin/roles" class="menu-item">
                <i class="ri-shield-user-line"></i>
                <span>角色管理</span>
            </a>
            <a href="/admin/permissions" class="menu-item">
                <i class="ri-key-line"></i>
                <span>权限管理</span>
            </a>

            <div class="menu-title">题目管理</div>
            <div class="menu-item" onclick="alert('题目列表功能开发中')">
                <i class="ri-file-list-line"></i>
                <span>题目列表</span>
            </div>
            <div class="menu-item" onclick="alert('添加题目功能开发中')">
                <i class="ri-add-circle-line"></i>
                <span>添加题目</span>
            </div>

            <div class="menu-title">班级管理</div>
            <div class="menu-item" onclick="alert('班级列表功能开发中')">
                <i class="ri-group-line"></i>
                <span>班级列表</span>
            </div>
            <div class="menu-item" onclick="alert('创建班级功能开发中')">
                <i class="ri-team-line"></i>
                <span>创建班级</span>
            </div>

            <div class="menu-title">系统管理</div>
            <div class="menu-item" onclick="alert('系统设置功能开发中')">
                <i class="ri-settings-line"></i>
                <span>系统设置</span>
            </div>
            <div class="menu-item" onclick="alert('导出报表功能开发中')">
                <i class="ri-file-chart-line"></i>
                <span>导出报表</span>
            </div>
        </div>

        <!-- 主内容区 -->
        <div class="main-content">
            <!-- 页面头部 -->
            <div class="page-header">
                <h1 class="page-title">管理员控制台</h1>
                <p class="page-subtitle">欢迎回来！您拥有系统的最高管理权限</p>
            </div>

            <!-- 统计数据 -->
            <div class="stats-grid">
                <div class="stat-card">
                    <div class="stat-header">
                        <div>
                            <div class="stat-value" th:text="${userCount}">0</div>
                            <div class="stat-label">用户总数</div>
                        </div>
                        <div class="stat-icon purple">
                            <i class="ri-user-line"></i>
                        </div>
                    </div>
                </div>

                <div class="stat-card">
                    <div class="stat-header">
                        <div>
                            <div class="stat-value" th:text="${roleCount}">0</div>
                            <div class="stat-label">角色数量</div>
                        </div>
                        <div class="stat-icon blue">
                            <i class="ri-shield-user-line"></i>
                        </div>
                    </div>
                </div>

                <div class="stat-card">
                    <div class="stat-header">
                        <div>
                            <div class="stat-value" th:text="${permissionCount}">0</div>
                            <div class="stat-label">权限数量</div>
                        </div>
                        <div class="stat-icon green">
                            <i class="ri-key-line"></i>
                        </div>
                    </div>
                </div>

                <div class="stat-card">
                    <div class="stat-header">
                        <div>
                            <div class="stat-value">22</div>
                            <div class="stat-label">我的权限</div>
                        </div>
                        <div class="stat-icon orange">
                            <i class="ri-checkbox-multiple-line"></i>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 管理员权限功能 -->
            <h2 class="section-title">
                <i class="ri-function-line"></i>
                管理功能
            </h2>

            <div class="feature-grid">
                <!-- 用户管理 -->
                <a href="/admin/users" class="feature-card">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-user-settings-line"></i>
                        </div>
                        <div class="feature-title">用户管理</div>
                    </div>
                    <div class="feature-description">
                        查看、添加、编辑、删除系统用户，管理用户状态和角色分配
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">user:view</span>
                        <span class="permission-badge">user:add</span>
                        <span class="permission-badge">user:edit</span>
                        <span class="permission-badge">user:delete</span>
                    </div>
                </a>

                <!-- 角色管理 -->
                <a href="/admin/roles" class="feature-card">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-shield-user-line"></i>
                        </div>
                        <div class="feature-title">角色管理</div>
                    </div>
                    <div class="feature-description">
                        创建和管理系统角色，配置角色权限，查看角色分配情况
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">role:view</span>
                        <span class="permission-badge">role:add</span>
                        <span class="permission-badge">role:edit</span>
                        <span class="permission-badge">role:delete</span>
                    </div>
                </a>

                <!-- 题目管理 -->
                <a href="#" class="feature-card" onclick="alert('题目管理功能开发中'); return false;">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-file-list-3-line"></i>
                        </div>
                        <div class="feature-title">题目管理</div>
                    </div>
                    <div class="feature-description">
                        添加、编辑、删除题目，管理题目分类和难度，设置测试用例
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">problem:view</span>
                        <span class="permission-badge">problem:add</span>
                        <span class="permission-badge">problem:edit</span>
                        <span class="permission-badge">problem:delete</span>
                    </div>
                </a>

                <!-- 提交管理 -->
                <a href="#" class="feature-card" onclick="alert('提交管理功能开发中'); return false;">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-file-code-line"></i>
                        </div>
                        <div class="feature-title">提交管理</div>
                    </div>
                    <div class="feature-description">
                        查看所有提交记录，重新评测代码，管理评测队列
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">submission:view</span>
                        <span class="permission-badge">submission:rejudge</span>
                    </div>
                </a>

                <!-- 班级管理 -->
                <a href="#" class="feature-card" onclick="alert('班级管理功能开发中'); return false;">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-group-line"></i>
                        </div>
                        <div class="feature-title">班级管理</div>
                    </div>
                    <div class="feature-description">
                        创建和管理班级，分配班主任，管理班级学生，查看班级统计
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">class:view</span>
                        <span class="permission-badge">class:add</span>
                        <span class="permission-badge">class:edit</span>
                        <span class="permission-badge">class:delete</span>
                        <span class="permission-badge">class:manage_students</span>
                    </div>
                </a>

                <!-- 系统管理 -->
                <a href="#" class="feature-card" onclick="alert('系统管理功能开发中'); return false;">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-settings-3-line"></i>
                        </div>
                        <div class="feature-title">系统管理</div>
                    </div>
                    <div class="feature-description">
                        系统配置、数据库维护、日志查看、备份恢复等高级功能
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">system:manage</span>
                    </div>
                </a>

                <!-- 报表导出 -->
                <a href="#" class="feature-card" onclick="alert('报表导出功能开发中'); return false;">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-file-chart-line"></i>
                        </div>
                        <div class="feature-title">报表导出</div>
                    </div>
                    <div class="feature-description">
                        导出用户数据、提交统计、成绩报表等各类数据报表
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">report:export</span>
                    </div>
                </a>

                <!-- 权限管理 -->
                <a href="/admin/permissions" class="feature-card">
                    <div class="feature-header">
                        <div class="feature-icon">
                            <i class="ri-key-2-line"></i>
                        </div>
                        <div class="feature-title">权限配置</div>
                    </div>
                    <div class="feature-description">
                        查看所有系统权限，配置角色权限关系，管理访问控制
                    </div>
                    <div class="feature-permissions">
                        <span class="permission-badge">permission:view</span>
                        <span class="permission-badge">permission:add</span>
                        <span class="permission-badge">permission:edit</span>
                        <span class="permission-badge">permission:delete</span>
                    </div>
                </a>
            </div>
        </div>
    </div>
</body>
</html>


